<?php
	
	class Tag { 
		
		private $_db ;

		public function Tag($db) {
			$this->_db = $db ;
		}
		
		public function insert($nome) {
			$new_user = array (
				'nome' => $nome
			);

			$this->_db->insert('questao', $new_user) ;
		}
		

		public function delete($nome) {
			$this->_db->delete('tag', 'nome = \'' . $nome . '\'') ;
		}
		
		public function select_from($cols, $where) {
			
			$this->_db->setFetchMode(Zend_Db::FETCH_OBJ) ;
			$col_str = '' ;
			$len = sizeof($cols) ;
			
			for ($i = 0; $i < $len; $i++) {
				if ($i > 0)
					$col_str .= ',' ;
				$col_str .= $cols[i] ;
			}
			
			$res = $this->_db->fetchAll('SELECT ' . $col_str . ' FROM tag ' . $where) ;
			return $res ;
		}
		
		public function update($array_cols, $nome) {
			$this->_db->update('tag', $array_cols, 'nome = \'' . $login . '\'') ;
		}
		
		
	}

?>